<?php
/**
 * CreateTime: 2023/7/24 16:26
 */
namespace App\Scopes;

use App\Func\ScopeFunc\AuthScopeStaffFunc;
use App\Func\TokenFuc;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;

class MediationCompanyIdScope  implements Scope
{
    public function apply(Builder $builder, Model $model)
    {
        // 客户端使用根据公司ID过滤
        $companyId = TokenFuc::getCurrentStaffInfo()['company_id'];

        $builder->where('company_id', $companyId);
    }
}